<?php

namespace Admin\Controller;

/**
 * PHPEmailer测试
 */
class EmailController extends AdminController {
	function index() {
		$this->display ();
	}
	function sendemail() {
		if (IS_POST) {
			$email = new \Think\Mail ();
			$emailaddress = I ( 'emailaddress' );
			$emailtitle = I ( 'emailtitle' );
			$emailmessage = I ( 'emailmessage' );
			$emailfromname = I ( 'emailfromname' );
			$result = $email->SendMail ( $emailaddress, $emailtitle, $emailmessage, $emailfromname );
			if (! empty ( $result )) {
				$this->success ( '邮件发送成功！', U ( 'index' ) );
			} else {
				$this->error ( '邮件发送失败！' );
			}
		}
	}
}
?>